<?php
/**
 * Created by PhpStorm.
 * User: 陈鸿
 * Date: 2016/5/17
 * Time: 17:52
 */
use QC\QQ;
include 'demo/index.html';
function __autoload($class){
    include dirname(dirname(__FILE__)) . '/' . str_replace('\\','/',$class) . '.php';
}

$callback = $_SERVER['PHP_SELF'];

if ( $callback )
{
    $result = QQ::getAccessTokenAndOpenId('101314219','4e62b1b199e64fe7e9e5c1a4e733e3dd');
//    $userInfo = QQ::getUserInfo($result['access_token'],$result['openId']);
//    $otherInfo = QQ::getOtherInfo($result['access_token'],$result['openId']);
    $info = QQ::getInfo($result['access_token'],$result['openId']);
    echo '<pre>';
    print_r($result);
//    print_r($userInfo);
//    print_r($otherInfo);
    print_r($info);
    return;
} else {
    QQ::login([
        /*'app'=>[
            'appId'      => '101314219',
            'appKey'     => '4e62b1b199e64fe7e9e5c1a4e733e3dd',
            'callback'   => 'http://qq.hong.chen.inner.layabox.com/callback',
            'scope'      => 'get_user_info',//建议只填写一个。获取用户信息少比较容易登陆成功。
            //'scope'      => 'get_user_info,get_other_info,get_info',
        ],*/
        'ext' => [
            'proxyurl' => 'http://www.layabox.com',
            'sp' => '40'
        ]
    ]);
}